package com.cykj.util;

import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;


public class BCryptUtil {
    private static final BCryptPasswordEncoder encoder = new BCryptPasswordEncoder();

    /**
     * 加密明文密码
     */
    public static String encrypt(String plainPassword) {
        return encoder.encode(plainPassword);
    }

    /**
     * 验证密码是否匹配
     */
    public static boolean matches(String plainPassword, String encryptedPassword) {
        return encoder.matches(plainPassword, encryptedPassword);
    }
}
